package cn.hebutrun.oulabot.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaolong
 * @since 2022-10-09
 */
@Api(tags = "在线加密接口")
@RestController
@RequestMapping("/jasypt")
@RequiredArgsConstructor
public class EncryptController {

  private final StringEncryptor jasyptStringEncryptor;

  @GetMapping
  @ApiOperation("jasypt加密")
  public String encryptString(@RequestParam String str) {
    return jasyptStringEncryptor.encrypt(str);
  }

}
